﻿#include "mydata.h"

MyData::MyData(QObject *parent) : QObject(parent)
{
    //关卡,0空地,1墙,2人物,4箱子,7终点,9人物加终点,11箱子加终点
    int array1[10][10] = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
                          {0, 0, 1, 1, 1, 0, 0, 0, 0, 0},
                          {0, 0, 1, 0, 1, 0, 0, 0, 0, 0},
                          {0, 0, 1, 0, 1, 1, 1, 1, 0, 0},
                          {0, 0, 1, 2, 0, 0, 0, 1, 0, 0},
                          {0, 0, 1, 0, 4, 1, 1, 1, 0, 0},
                          {0, 0, 1, 0, 0, 1, 0, 0, 0, 0},
                          {0, 0, 1, 0, 7, 1, 0, 0, 0, 0},
                          {0, 0, 1, 1, 1, 1, 0, 0, 0, 0},
                          {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
    int array2[10][10] = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
                          {0, 0, 1, 1, 1, 1, 1, 1, 0, 0},
                          {0, 0, 1, 0, 0, 0, 0, 1, 0, 0},
                          {0, 0, 1, 0, 0, 0, 0, 1, 0, 0},
                          {0, 0, 1, 2, 0, 4, 0, 1, 0, 0},
                          {0, 0, 1, 0, 4, 0, 1, 1, 0, 0},
                          {0, 0, 1, 0, 0, 0, 0, 1, 0, 0},
                          {0, 0, 1, 0, 7, 0, 7, 1, 0, 0},
                          {0, 0, 1, 1, 1, 1, 1, 1, 0, 0},
                          {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
    int array3[10][10] = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
                          {0, 0, 0, 1, 1, 1, 1, 0, 0, 0},
                          {0, 0, 0, 1, 0, 0, 1, 1, 1, 0},
                          {0, 1, 1, 1, 0, 0, 0, 0, 1, 0},
                          {0, 1, 0, 0, 11, 7, 1, 0, 1, 0},
                          {0, 1, 0, 0, 4, 11, 0, 0, 1, 0},
                          {0, 1, 1, 1, 0, 2, 1, 1, 1, 0},
                          {0, 0, 0, 1, 0, 0, 1, 0, 0, 0},
                          {0, 0, 0, 1, 1, 1, 1, 0, 0, 0},
                          {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
    int array4[10][10] = {{0, 0, 0, 1, 1, 1, 1, 0, 0, 0},
                          {0, 0, 1, 1, 0, 0, 1, 0, 0, 0},
                          {0, 0, 1, 0, 2, 0, 1, 0, 0, 0},
                          {0, 0, 1, 0, 4, 0, 1, 0, 0, 0},
                          {0, 0, 1, 0, 11, 0, 1, 0, 0, 0},
                          {0, 0, 1, 0, 11, 0, 1, 1, 0, 0},
                          {0, 0, 1, 1, 7, 0, 0, 1, 0, 0},
                          {0, 0, 0, 1, 0, 1, 0, 1, 0, 0},
                          {0, 0, 0, 1, 0, 0, 0, 1, 0, 0},
                          {0, 0, 0, 1, 1, 1, 1, 1, 0, 0}};
    int array5[10][10] = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
                          {0, 1, 1, 1, 1, 1, 1, 1, 1, 0},
                          {0, 1, 0, 0, 0, 1, 0, 0, 1, 0},
                          {0, 1, 0, 1, 0, 1, 4, 7, 1, 0},
                          {0, 1, 0, 0, 0, 0, 4, 7, 1, 0},
                          {0, 1, 0, 1, 0, 1, 4, 7, 1, 0},
                          {0, 1, 0, 0, 0, 1, 0, 0, 1, 0},
                          {0, 1, 1, 1, 1, 1, 2, 0, 1, 0},
                          {0, 0, 0, 0, 0, 1, 1, 1, 1, 0},
                          {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
    int array6[10][10] = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
                          {0, 1, 1, 1, 1, 1, 1, 1, 0, 0},
                          {0, 1, 0, 0, 0, 0, 0, 1, 1, 1},
                          {1, 1, 4, 1, 1, 1, 0, 0, 0, 1},
                          {1, 2, 0, 0, 4, 0, 0, 4, 0, 1},
                          {1, 0, 7, 7, 1, 0, 4, 0, 1, 1},
                          {1, 1, 7, 7, 1, 0, 0, 0, 1, 0},
                          {0, 1, 1, 1, 1, 1, 1, 1, 1, 0},
                          {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
                          {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
    int array7[10][10] = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
                          {0, 0, 0, 1, 1, 1, 1, 1, 1, 1},
                          {0, 0, 1, 1, 0, 0, 1, 0, 2, 1},
                          {0, 0, 1, 0, 0, 0, 1, 0, 0, 1},
                          {0, 0, 1, 4, 0, 4, 0, 4, 0, 1},
                          {0, 0, 1, 0, 4, 1, 1, 0, 0, 1},
                          {1, 1, 1, 0, 4, 0, 1, 0, 1, 1},
                          {1, 7, 7, 7, 7, 7, 0, 0, 1, 0},
                          {1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
                          {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
    int array8[10][10] = {{0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
                          {0, 0, 0, 1, 1, 1, 1, 1, 1, 0},
                          {0, 1, 1, 1, 0, 0, 0, 0, 1, 0},
                          {1, 1, 7, 0, 4, 1, 1, 0, 1, 1},
                          {1, 7, 7, 4, 0, 4, 0, 0, 2, 1},
                          {1, 7, 7, 0, 4, 0, 4, 0, 1, 1},
                          {1, 1, 1, 1, 1, 1, 0, 0, 1, 0},
                          {0, 0, 0, 0, 0, 1, 1, 1, 1, 0},
                          {0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
                          {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};
    int array9[10][10] = {{0, 1, 1, 1, 1, 1, 1, 0, 0, 0},
                          {1, 1, 0, 0, 0, 0, 1, 1, 0, 0},
                          {1, 0, 0, 1, 1, 0, 0, 1, 0, 0},
                          {1, 0, 1, 0, 0, 1, 0, 1, 0, 0},
                          {1, 7, 0, 0, 7, 1, 4, 1, 1, 0},
                          {1, 0, 1, 0, 11, 0, 4, 0, 1, 0},
                          {1, 0, 1, 0, 11, 0, 4, 2, 1, 0},
                          {1, 0, 0, 7, 7, 0, 4, 0, 1, 0},
                          {1, 1, 1, 1, 1, 1, 1, 1, 1, 0},
                          {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};


    //放入容器
    forData(dataSelect, 1, array1);
    forData(dataSelect, 2, array2);
    forData(dataSelect, 3, array3);
    forData(dataSelect, 4, array4);
    forData(dataSelect, 5, array5);
    forData(dataSelect, 6, array6);
    forData(dataSelect, 7, array7);
    forData(dataSelect, 8, array8);
    forData(dataSelect, 9, array9);
}

void MyData::forData(QMap<int, QVector<QVector<int>>> &myDataSelect, int include, int (*array)[10])
{
    QVector<QVector<int>> v;
    for(int i = 0; i <10; i++)
    {
        QVector<int> v1;
        for(int j = 0; j < 10; j++)
        {
            v1.push_back(array[i][j]);
        }
        v.push_back(v1);
    }
    myDataSelect.insert(include, v);
}
